package com.sbj.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.sbj.dto.jackson.CustomDecimalSerialize;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/9 12:03
 */
@Data
@SearchBean(tables = " goods g LEFT JOIN quality q ON g.quality_id=q.id  LEFT JOIN category c ON g.category_id=c.id ",autoMapTo = "g",orderBy = " g.createTime DESC ")
public class GoodsRes implements Serializable {

    @DbField("g.id")
    private Integer id;

    @DbField("g.isListed")
    private Integer isListed;

    @DbField("g.name")
    private String name;

    @DbField("g.category_id")
    private Integer categoryId;

    @DbField("c.name")
    private String categoryName;

    @DbField("g.context")
    private String context;

    @DbField("g.stock")
    private Integer stock;

    @DbField("g.image")
    private String image;

    @DbField("g.ruing_price")
    @JsonSerialize(using = CustomDecimalSerialize.class)
    private BigDecimal ruingPrice;

    @DbField("g.original_price")
    private BigDecimal originalPrice;

    @DbField("g.deleted")
    private Integer deleted;

    @DbField("g.createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;


    @DbField("q.name")
    private String qualityName;



}
